Virtual ordered writes for multiple storage devices

ABSTRACT

A computer-implemented method of ordering data writes includes at least some of a plurality of primary storage devices receiving a first plurality of data writes and causing a cycle switch for the plurality of primary storage devices. The first plurality of data writes are associated with a particular cycle on each primary storage device in the plurality of primary storage devices. At least some of the plurality of primary storage devices receive a second plurality of writes after initiating the cycle switch. All of the second plurality of writes are associated with a cycle different from the particular cycle on each of the plurality of primary storage devices.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.10/724,669 filed on Dec. 1, 2003 now U.S. Pat. No. 7,054,883.

BACKGROUND OF THE INVENTION

1. Technical Field

This application relates to computer storage devices, and moreparticularly to the field of transferring data between storage devices.

2. Description of Related Art

Host processor systems may store and retrieve data using a storagedevice containing a plurality of host interface units (host adapters),disk drives, and disk interface units (disk adapters). Such storagedevices are provided, for example, by EMC Corporation of Hopkinton,Mass. and disclosed in U.S. Pat. No. 5,206,939 to Yanai et al., U.S.Pat. No. 5,778,394 to Galtzur et al., U.S. Pat. No. 5,845,147 toVishlitzky et al., and U.S. Pat. No. 5,857,208 to Ofek. The host systemsaccess the storage device through a plurality of channels providedtherewith. Host systems provide data and access control informationthrough the channels to the storage device and the storage deviceprovides data to the host systems also through the channels. The hostsystems do not address the disk drives of the storage device directly,but rather, access what appears to the host systems as a plurality oflogical disk units. The logical disk units may or may not correspond tothe actual disk drives. Allowing multiple host systems to access thesingle storage device unit allows the host systems to share data storedtherein.

In some instances, it may be desirable to copy data from one storagedevice to another. For example, if a host writes data to a first storagedevice, it may be desirable to copy that data to a second storage deviceprovided in a different location so that if a disaster occurs thatrenders the first storage device inoperable, the host (or another host)may resume operation using the data of the second storage device. Such acapability is provided, for example, by the Remote Data Facility (RDF)product provided by EMC Corporation of Hopkinton, Mass. With RDF, afirst storage device, denoted the “primary storage device” (or “R1”) iscoupled to the host. One or more other storage devices, called“secondary storage devices” (or “R2”) receive copies of the data that iswritten to the primary storage device by the host. The host interactsdirectly with the primary storage device, but any data changes made tothe primary storage device are automatically provided to the one or moresecondary storage devices using RDF. The primary and secondary storagedevices may be connected by a data link, such as an ESCON link, a FibreChannel link, and/or a Gigabit Ethernet link. The RDF functionality maybe facilitated with an RDF adapter (RA) provided at each of the storagedevices.

RDF allows synchronous data transfer where, after data written from ahost to a primary storage device is transferred from the primary storagedevice to a secondary storage device using RDF, receipt is acknowledgedby the secondary storage device to the primary storage device which thenprovides a write acknowledge back to the host. Thus, in synchronousmode, the host does not receive a write acknowledge from the primarystorage device until the RDF transfer to the secondary storage devicehas been completed and acknowledged by the secondary storage device.

A drawback to the synchronous RDF system is that the latency of each ofthe write operations is increased by waiting for the acknowledgement ofthe RDF transfer. This problem is worse when there is a long distancebetween the primary storage device and the secondary storage device;because of transmission delays, the time delay required for making theRDF transfer and then waiting for an acknowledgement back after thetransfer is complete may be unacceptable.

It is also possible to use RDF in an a semi-synchronous mode, in whichcase the data is written from the host to the primary storage devicewhich acknowledges the write immediately and then, at the same time,begins the process of transferring the data to the secondary storagedevice. Thus, for a single transfer of data, this scheme overcomes someof the disadvantages of using RDF in the synchronous mode. However, fordata integrity purposes, the semi-synchronous transfer mode does notallow the primary storage device to transfer data to the secondarystorage device until a previous transfer is acknowledged by thesecondary storage device. Thus, the bottlenecks associated with usingRDF in the synchronous mode are simply delayed by one iteration becausetransfer of a second amount of data cannot occur until transfer ofprevious data has been acknowledged by the secondary storage device.

Another possibility is to have the host write data to the primarystorage device in asynchronous mode and have the primary storage devicecopy data to the secondary storage device in the background. Thebackground copy involves cycling through each of the tracks of theprimary storage device sequentially and, when it is determined that aparticular block has been modified since the last time that block wascopied, the block is transferred from the primary storage device to thesecondary storage device. Although this mechanism may attenuate thelatency problem associated with synchronous and semi-synchronous datatransfer modes, a difficulty still exists because there can not be aguarantee of data consistency between the primary and secondary storagedevices. If there are problems, such as a failure of the primary system,the secondary system may end up with out-of-order changes that make thedata unusable.

A proposed solution to this problem is the Symmetrix AutomatedReplication (SAR) process, which is described in pending U.S. patentapplication Ser. Nos. 10/224,918 and 10/225,021, both of which werefiled on Aug. 21, 2002. The SAR uses devices (BCV's) that can mirrorstandard logical devices. A BCV device can also be split from itsstandard logical device after being mirrored and can be resynced (i.e.,reestablished as a mirror) to the standard logical devices after beingsplit. In addition, a BCV can be remotely mirrored using RDF, in whichcase the BCV may propagate data changes made thereto (while the BCV isacting as a mirror) to the BCV remote mirror when the BCV is split fromthe corresponding standard logical device.

However, using the SAR process requires the significant overhead ofcontinuously splitting and resyncing the BCV's. The SAR process alsouses host control and management, which relies on the controlling hostbeing operational. In addition, the cycle time for a practicalimplementation of a SAR process is on the order of twenty to thirtyminutes, and thus the amount of data that may be lost when an RDF linkand/or primary device fails could be twenty to thirty minutes worth ofdata.

Thus, it would be desirable to have an RDF system that exhibits some ofthe beneficial qualities of each of the different techniques discussedabove while reducing the drawbacks. Such a system would exhibit lowlatency for each host write regardless of the distance between theprimary device and the secondary device and would provide consistency(recoverability) of the secondary device in case of failure.

SUMMARY OF THE INVENTION

According to the present invention, ordering data writes includes atleast some of a group of primary storage devices receiving a firstplurality of data writes, causing a cycle switch for the group ofprimary storage devices where the first plurality of data writes areassociated with a particular cycle on each primary storage device in thegroup, and at least some of the group of primary storage devicesreceiving a second plurality of writes after initiating the cycle switchwhere all of the second plurality of writes are associated with a cycledifferent from the particular cycle on each primary storage device.Writes to the group begun after initiating the cycle switch may notcomplete until after the cycle switch has completed. Ordering datawrites may also include, after completion of the cycle switch, each ofthe primary storage devices of the group initiating transfer of thefirst plurality of writes to a corresponding secondary storage device.Ordering data writes may also include, following each of the primarystorage devices of the group completing transfer of the first pluralityof writes to a corresponding secondary storage device, each of theprimary storage devices sending a message to the corresponding secondarystorage device. Ordering data writes may also include providing thefirst plurality of data writes to cache slots of the group of primarystorage device. Receiving a first plurality of data writes may alsoinclude receiving a plurality of data writes from a host. A host maycause the cycle switch. Ordering data writes may also include waiting apredetermined amount of time, determining if all of the primary storagedevices of the group of storage devices is ready to switch, and, foreach of the primary storage devices of the group, sending a firstcommand thereto to cause a cycle switch. Sending a command to cause acycle switch may also cause writes begun after the first command to notcomplete until a second command is received. Ordering data writes mayalso include, after sending the first command to all of the primarystorage devices of the group, sending the second command to all of theprimary storage devices to allow writes to complete.

According further to the present invention, computer software thatorders data writes to a group of primary storage devices includesexecutable code that causes a cycle switch for the group of primarystorage devices where the first plurality of data writes are associatedwith a particular cycle on each primary storage device in the group andexecutable code that, for a second plurality of writes provided afterinitiating the cycle switch, associates all of the second plurality ofwrites with a cycle different from the particular cycle on each primarystorage device. Writes to the group begun after initiating the cycleswitch may not complete until after the cycle switch has completed. Thecomputer software may also include executable code that causes each ofthe primary storage devices of the group to initiate transfer of thefirst plurality of writes to a corresponding secondary storage deviceafter completion of the cycle switch. The computer software may alsoinclude executable code that causes each of the primary storage devicesto send a message to the corresponding secondary storage devicefollowing each of the primary storage devices of the group completingtransfer of the first plurality of writes to a corresponding secondarystorage device. The computer software may also include executable codethat provides the first plurality of data writes to cache slots of thegroup of primary storage device. The first plurality of data writes maybe from a host. A host may run executable code that causes the cycleswitch. Executable code that causes the cycle switch may includeexecutable code that waits a predetermined amount of time, executablecode that determines if all of the primary storage devices of the groupof storage devices is ready to switch, and executable code that sends afirst command to each of the primary storage devices of the group tocause a cycle switch. Executable code that sends a command to cause acycle switch may also cause writes begun after the first command to notcomplete until a second command is received. The computer software mayalso include executable code that sends the second command to all of theprimary storage devices to allow writes to complete after sending thefirst command to all of the primary storage devices of the group.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a schematic diagram showing a host, a local storage device,and a remote data storage device used in connection with the systemdescribed herein.

FIG. 2 is a schematic diagram showing a flow of data between a host, alocal storage device, and a remote data storage device used inconnection with the system described herein.

FIG. 3 is a schematic diagram illustrating items for constructing andmanipulating chunks of data on a local storage device according to thesystem described herein.

FIG. 4 is a diagram illustrating a data structure for a slot used inconnection with the system described herein.

FIG. 5 is a flow chart illustrating operation of a host adaptor (HA) inresponse to a write by a host according to the system described herein.

FIG. 6 is a flow chart illustrating transferring data from a localstorage device to a remote storage device according to the systemdescribed herein.

FIG. 7 is a schematic diagram illustrating items for constructing andmanipulating chunks of data on a remote storage device according to thesystem described herein.

FIG. 8 is a flow chart illustrating steps performed by a remote storagedevice in connection with receiving a commit indicator from a localstorage device according to the system described herein.

FIG. 9 is a flow chart illustrating storing transmitted data at a remotestorage device according to the system described herein.

FIG. 10 is a flow chart illustrating steps performed in connection witha local storage device incrementing a sequence number according to asystem described herein.

FIG. 11 is a schematic diagram illustrating items for constructing andmanipulating chunks of data on a local storage device according to analternative embodiment of the system described herein.

FIG. 12 is a flow chart illustrating operation of a host adaptor (HA) inresponse to a write by a host according to an alternative embodiment ofthe system described herein.

FIG. 13 is a flow chart illustrating transferring data from a localstorage device to a remote storage device according to an alternativeembodiment of the system described herein.

FIG. 14 is a schematic diagram illustrating a plurality of local andremote storage devices with a host according to the system describedherein.

FIG. 15 is a diagram showing a multi-box mode table used in connectionwith the system described herein.

FIG. 16 is a flow chart illustrating modifying a multi-box mode tableaccording to the system described herein.

FIG. 17 is a flow chart illustrating cycle switching by the hostaccording to the system described herein.

FIG. 18 is a flow chart illustrating steps performed in connection witha local storage device incrementing a sequence number according to asystem described herein.

FIG. 19 is a flow chart illustrating transferring data from a localstorage device to a remote storage device according to the systemdescribed herein.

FIG. 20 is a flow chart illustrating transferring data from a localstorage device to a remote storage device according to an alternativeembodiment of the system described herein.

FIG. 21 is a flow chart illustrating providing an active empty indicatormessage from a remote storage device to a corresponding local storagedevice according to the system described herein.

FIG. 22 is a schematic diagram illustrating a plurality of local andremote storage devices with a plurality of hosts according to the systemdescribed herein.

FIG. 23 is a flow chart illustrating a processing performed by a remotestorage device in connection with data recovery according to the systemdescribed herein.

FIG. 24 is a flow chart illustrating a processing performed by a host inconnection with data recovery according to the system described herein.

DETAILED DESCRIPTION OF VARIOUS EMBODIMENTS

Referring to FIG. 1, a diagram 20 shows a relationship between a host22, a local storage device 24 and a remote storage device 26. The host22 reads and writes data from and to the local storage device 24 via ahost adapter (HA) 28, which facilitates the interface between the host22 and the local storage device 24. Although the diagram 20 only showsone host 22 and one HA 28, it will be appreciated by one of ordinaryskill in the art that multiple HA's may be used and that one or moreHA's may have one or more hosts coupled thereto.

Data from the local storage device 24 is copied to the remote storagedevice 26 via an RDF link 29 to cause the data on the remote storagedevice 26 to be identical to the data on the local storage device 24.Although only the one link 29 is shown, it is possible to haveadditional links between the storage devices 24, 26 and to have linksbetween one or both of the storage devices 24, 26 and other storagedevices (not shown). Note that there may be a time delay between thetransfer of data from the local storage device 24 to the remote storagedevice 26, so that the remote storage device 26 may, at certain pointsin time, contain data that is not identical to the data on the localstorage device 24. Communication using RDF is described, for example, inU.S. Pat. No. 5,742,792, which is incorporated by reference herein.

The local storage device 24 includes a first plurality of RDF adapterunits (RA's) 30 a, 30 b, 30 c and the remote storage device 26 includesa second plurality of RA's 32 a-32 c. The RA's 30 a-30 c, 32 a-32 c arecoupled to the RDF link 29 and are similar to the host adapter 28, butare used to transfer data between the storage devices 24, 26. Thesoftware used in connection with the RA's 30 a-30 c, 32 a-32 c isdiscussed in more detail hereinafter.

The storage devices 24, 26 may include one or more disks, eachcontaining a different portion of data stored on each of the storagedevices 24, 26. FIG. 1 shows the storage device 24 including a pluralityof disks 33 a, 33 b, 33 c and the storage device 26 including aplurality of disks 34 a, 34 b, 34 c. The RDF functionality describedherein may be applied so that the data for at least a portion of thedisks 33 a-33 c of the local storage device 24 is copied, using RDF, toat least a portion of the disks 34 a-34 c of the remote storage device26. It is possible that other data of the storage devices 24, 26 is notcopied between the storage devices 24, 26, and thus is not identical.

Each of the disks 33 a-33 c is coupled to a corresponding disk adapterunit (DA) 35 a, 35 b, 35 c that provides data to a corresponding one ofthe disks 33 a-33 c and receives data from a corresponding one of thedisks 33 a-33 c. Similarly, a plurality of DA's 36 a, 36 b, 36 c of theremote storage device 26 are used to provide data to corresponding onesof the disks 34 a-34 c and receive data from corresponding ones of thedisks 34 a-34 c. An internal data path exists between the DA's 35 a-35c, the HA 28 and the RA's 30 a-30 c of the local storage device 24.Similarly, an internal data path exists between the DA's 36 a-36 c andthe RA's 32 a-32 c of the remote storage device 26. Note that, in otherembodiments, it is possible for more than one disk to be serviced by aDA and that it is possible for more than one DA to service a disk.

The local storage device 24 also includes a global memory 37 that may beused to facilitate data transferred between the DA's 35 a-35 c, the HA28 and the RA's 30 a-30 c. The memory 37 may contain tasks that are tobe performed by one or more of the DA's 35 a-35 c, the HA 28 and theRA's 30 a-30 c, and a cache for data fetched from one or more of thedisks 33 a-33 c. Similarly, the remote storage device 26 includes aglobal memory 38 that may contain tasks that are to be performed by oneor more of the DA's 36 a-36 c and the RA's 32 a-32 c, and a cache fordata fetched from one or more of the disks 34 a-34 c. Use of thememories 37, 38 is described in more detail hereinafter.

The storage space in the local storage device 24 that corresponds to thedisks 33 a-33 c may be subdivided into a plurality of volumes or logicaldevices. The logical devices may or may not correspond to the physicalstorage space of the disks 33 a-33 c. Thus, for example, the disk 33 amay contain a plurality of logical devices or, alternatively, a singlelogical device could span both of the disks 33 a, 33 b. Similarly, thestorage space for the remote storage device 26 that comprises the disks34 a-34 c may be subdivided into a plurality of volumes or logicaldevices, where each of the logical devices may or may not correspond toone or more of the disks 34 a-34 c.

Providing an RDF mapping between portions of the local storage device 24and the remote storage device 26 involves setting up a logical device onthe remote storage device 26 that is a remote mirror for a logicaldevice on the local storage device 24. The host 22 reads and writes datafrom and to the logical device on the local storage device 24 and theRDF mapping causes modified data to be transferred from the localstorage device 24 to the remote storage device 26 using the RA's, 30a-30 c, 32 a-32 c and the RDF link 29. In steady state operation, thelogical device on the remote storage device 26 contains data that isidentical to the data of the logical device on the local storage device24. The logical device on the local storage device 24 that is accessedby the host 22 is referred to as the “R1 volume” (or just “R1”) whilethe logical device on the remote storage device 26 that contains a copyof the data on the R1 volume is called the “R2 volume” (or just “R2”).Thus, the host reads and writes data from and to the R1 volume and RDFhandles automatic copying and updating of the data from the R1 volume tothe R2 volume.

Referring to FIG. 2, a path of data is illustrated from the host 22 tothe local storage device 24 and the remote storage device 26. Datawritten from the host 22 to the local storage device 24 is storedlocally, as illustrated by the data element 51 of the local storagedevice 24. The data that is written by the host 22 to the local storagedevice 24 is also maintained by the local storage device 24 inconnection with being sent by the local storage device 24 to the remotestorage device 26 via the link 29.

In the system described herein, each data write by the host 22 (of, forexample a record, a plurality of records, a track, etc.) is assigned asequence number. The sequence number may be provided in an appropriatedata field associated with the write. In FIG. 2, the writes by the host22 are shown as being assigned sequence number N. All of the writesperformed by the host 22 that are assigned sequence number N arecollected in a single chunk of data 52. The chunk 52 represents aplurality of separate writes by the host 22 that occur at approximatelythe same time.

Generally, the local storage device 24 accumulates chunks of onesequence number while transmitting a previously accumulated chunk(having the previous sequence number) to the remote storage device 26.Thus, while the local storage device 24 is accumulating writes from thehost 22 that are assigned sequence number N, the writes that occurredfor the previous sequence number (N−1) are transmitted by the localstorage device 24 to the remote storage device 26 via the link 29. Achunk 54 represents writes from the host 22 that were assigned thesequence number N−1 that have not been transmitted yet to the remotestorage device 26.

The remote storage device 26 receives the data from the chunk 54corresponding to writes assigned a sequence number N−1 and constructs anew chunk 56 of host writes having sequence number N−1. The data may betransmitted using appropriate RDF protocol that acknowledges data sentacross the link 29. When the remote storage device 26 has received allof the data from the chunk 54, the local storage device 24 sends acommit message to the remote storage device 26 to commit all the dataassigned the N−1 sequence number corresponding to the chunk 56.Generally, once a chunk corresponding to a particular sequence number iscommitted, that chunk may be written to the logical storage device. Thisis illustrated in FIG. 2 with a chunk 58 corresponding to writesassigned sequence number N−2 (i.e., two before the current sequencenumber being used in connection with writes by the host 22 to the localstorage device 26). In FIG. 2, the chunk 58 is shown as being written toa data element 62 representing disk storage for the remote storagedevice 26. Thus, the remote storage device 26 is receiving andaccumulating the chunk 56 corresponding to sequence number N−1 while thechunk 58 corresponding to the previous sequence number (N−2) is beingwritten to disk storage of the remote storage device 26 illustrated bythe data element 62. In some embodiments, the data for the chunk 58 ismarked for write (but not necessarily written immediately), while thedata for the chunk 56 is not.

Thus, in operation, the host 22 writes data to the local storage device24 that is stored locally in the data element 51 and is accumulated inthe chunk 52. Once all of the data for a particular sequence number hasbeen accumulated (described elsewhere herein), the local storage device24 increments the sequence number. Data from the chunk 54 correspondingto one less than the current sequence number is transferred from thelocal storage device 24 to the remote storage device 26 via the link 29.The chunk 58 corresponds to data for a sequence number that wascommitted by the local storage device 24 sending a message to the remotestorage device 26. Data from the chunk 58 is written to disk storage ofthe remote storage device 26.

Note that the writes within a particular one of the chunks 52, 54, 56,58 are not necessarily ordered. However, as described in more detailelsewhere herein, every write for the chunk 58 corresponding to sequencenumber N−2 was begun prior to beginning any of the writes for the chunks54, 56 corresponding to sequence number N−1. In addition, every writefor the chunks 54, 56 corresponding to sequence number N−1 was begunprior to beginning any of the writes for the chunk 52 corresponding tosequence number N. Thus, in the event of a communication failure betweenthe local storage device 24 and the remote storage device 26, the remotestorage device 26 may simply finish writing the last committed chunk ofdata (the chunk 58 in the example of FIG. 2) and can be assured that thestate of the data at the remote storage device 26 is ordered in thesense that the data element 62 contains all of the writes that werebegun prior to a certain point in time and contains no writes that werebegun after that point in time. Thus, R2 always contains a point in timecopy of R1 and it is possible to reestablish a consistent image from theR2 device.

Referring to FIG. 3, a diagram 70 illustrates items used to constructand maintain the chunks 52, 54. A standard logical device 72 containsdata written by the host 22 and corresponds to the data element 51 ofFIG. 2 and the disks 33 a-33 c of FIG. 1. The standard logical device 72contains data written by the host 22 to the local storage device 24.

Two linked lists of pointers 74, 76 are used in connection with thestandard logical device 72. The linked lists 74, 76 correspond to datathat may be stored, for example, in the memory 37 of the local storagedevice 24. The linked list 74 contains a plurality of pointers 81-85,each of which points to a slot of a cache 88 used in connection with thelocal storage device 24. Similarly, the linked list 76 contains aplurality of pointers 91-95, each of which points to a slot of the cache88. In some embodiments, the cache 88 may be provided in the memory 37of the local storage device 24. The cache 88 contains a plurality ofcache slots 102-104 that may be used in connection to writes to thestandard logical device 72 and, at the same time, used in connectionwith the linked lists 74, 76.

Each of the linked lists 74, 76 may be used for one of the chunks ofdata 52, 54 so that, for example, the linked list 74 may correspond tothe chunk of data 52 for sequence number N while the linked list 76 maycorrespond to the chunk of data 54 for sequence number N−1. Thus, whendata is written by the host 22 to the local storage device 24, the datais provided to the cache 88 and, in some cases (described elsewhereherein), an appropriate pointer of the linked list 74 is created. Notethat the data will not be removed from the cache 88 until the data isdestaged to the standard logical device 72 and the data is also nolonger pointed to by one of the pointers 81-85 of the linked list 74, asdescribed elsewhere herein.

In an embodiment herein, one of the linked lists 74, 76 is deemed“active” while the other is deemed “inactive”. Thus, for example, whenthe sequence number N is even, the linked list 74 may be active whilethe linked list 76 is inactive. The active one of the linked lists 74,76 handles writes from the host 22 while the inactive one of the linkedlists 74, 76 corresponds to the data that is being transmitted from thelocal storage device 24 to the remote storage device 26.

While the data that is written by the host 22 is accumulated using theactive one of the linked lists 74, 76 (for the sequence number N), thedata corresponding to the inactive one of the linked lists 74, 76 (forprevious sequence number N−1) is transmitted from the local storagedevice 24 to the remote storage device 26. The RA's 30 a-30 c use thelinked lists 74, 76 to determine the data to transmit from the localstorage device 24 to the remote storage device 26.

Once data corresponding to a particular one of the pointers in one ofthe linked lists 74, 76 has been transmitted to the remote storagedevice 26, the particular one of the pointers may be removed from theappropriate one of the linked lists 74, 76. In addition, the data mayalso be marked for removal from the cache 88 (i.e., the slot may bereturned to a pool of slots for later, unrelated, use) provided that thedata in the slot is not otherwise needed for another purpose (e.g., tobe destaged to the standard logical device 72). A mechanism may be usedto ensure that data is not removed from the cache 88 until all devicesare no longer using the data. Such a mechanism is described, forexample, in U.S. Pat. No. 5,537,568 issued on Jul. 16, 1996 and in U.S.patent application Ser. No. 09/850,551 filed on Jul. 7, 2001, both ofwhich are incorporated by reference herein.

Referring to FIG. 4, a slot 120, like one of the slots 102-104 of thecache 88, includes a header 122 and data 124. The header 122 correspondsto overhead information used by the system to manage the slot 120. Thedata 124 is the corresponding data from the disk that is being(temporarily) stored in the slot 120. Information in the header 122includes pointers back to the disk, time stamp(s), etc.

The header 122 also includes a cache stamp 126 used in connection withthe system described herein. In an embodiment herein, the cache stamp126 is eight bytes. Two of the bytes are a “password” that indicateswhether the slot 120 is being used by the system described herein. Inother embodiments, the password may be one byte while the following byteis used for a pad. As described elsewhere herein, the two bytes of thepassword (or one byte, as the case may be) being equal to a particularvalue indicates that the slot 120 is pointed to by at least one entry ofthe linked lists 74, 76. The password not being equal to the particularvalue indicates that the slot 120 is not pointed to by an entry of thelinked lists 74, 76. Use of the password is described elsewhere herein.

The cache stamp 126 also includes a two byte field indicating thesequence number (e.g., N, N−1, N−2, etc.) of the data 124 of the slot120. As described elsewhere herein, the sequence number field of thecache stamp 126 may be used to facilitate the processing describedherein. The remaining four bytes of the cache stamp 126 may be used fora pointer, as described elsewhere herein. Of course, the two bytes ofthe sequence number and the four bytes of the pointer are only validwhen the password equals the particular value that indicates that theslot 120 is pointed to by at least one entry in one of the lists 74, 76.

Referring to FIG. 5, a flow chart 140 illustrates steps performed by theHA 28 in connection with a host 22 performing a write operation. Ofcourse, when the host 22 performs a write, processing occurs forhandling the write in a normal fashion irrespective of whether the datais part of an R1/R2 RDF group. For example, when the host 22 writes datafor a portion of the disk, the write occurs to a cache slot which iseventually destaged to the disk. The cache slot may either be a newcache slot or may be an already existing cache slot created inconnection with a previous read and/or write operation to the sametrack.

Processing begins at a first step 142 where a slot corresponding to thewrite is locked. In an embodiment herein, each of the slots 102-104 ofthe cache 88 corresponds to a track of data on the standard logicaldevice 72. Locking the slot at the step 142 prevents additionalprocesses from operating on the relevant slot during the processingperformed by the HA 28 corresponding to the steps of the flow chart 140.

Following step 142 is a step 144 where a value for N, the sequencenumber, is set. As discussed elsewhere herein, the value for thesequence number obtained at the step 144 is maintained during the entirewrite operation performed by the HA 28 while the slot is locked. Asdiscussed elsewhere herein, the sequence number is assigned to eachwrite to set the one of the chunks of data 52, 54 to which the writebelongs. Writes performed by the host 22 are assigned the currentsequence number. It is useful that a single write operation maintain thesame sequence number throughout.

Following the step 144 is a test step 146 which determines if thepassword field of the cache slot is valid. As discussed above, thesystem described herein sets the password field to a predetermined valueto indicate that the cache slot is already in one of the linked lists ofpointers 74, 76. If it is determined at the test step 146 that thepassword field is not valid (indicating that the slot is new and that nopointers from the lists 74, 76 point to the slot), then control passesfrom the step 146 to a step 148, where the cache stamp of the new slotis set by setting the password to the predetermined value, setting thesequence number field to N, and setting the pointer field to Null. Inother embodiments, the pointer field may be set to point to the slotitself.

Following the step 148 is a step 152 where a pointer to the new slot isadded to the active one of the pointer lists 74, 76. In an embodimentherein, the lists 74, 76 are circular doubly linked lists, and the newpointer is added to the circular doubly linked list in a conventionalfashion. Of course, other appropriate data structures could be used tomanage the lists 74, 76. Following the step 152 is a step 154 whereflags are set. At the step 154, the RDF_WP flag (RDF write pending flag)is set to indicate that the slot needs to be transmitted to the remotestorage device 26 using RDF. In addition, at the step 154, the IN_CACHEflag is set to indicate that the slot needs to be destaged to thestandard logical device 72. Following the step 154 is a step 156 wherethe data being written by the host 22 and the HA 28 is written to theslot. Following the step 156 is a step 158 where the slot is unlocked.Following step 158, processing is complete.

If it is determined at the test step 146 that the password field of theslot is valid (indicating that the slot is already pointed to by atleast one pointer of the lists 74, 76), then control transfers from thestep 146 to a test step 162, where it is determined whether the sequencenumber field of the slot is equal to the current sequence number, N.Note that there are two valid possibilities for the sequence numberfield of a slot with a valid password. It is possible for the sequencenumber field to be equal to N, the current sequence number. This occurswhen the slot corresponds to a previous write with sequence number N.The other possibility is for the sequence number field to equal N−1.This occurs when the slot corresponds to a previous write with sequencenumber N−1. Any other value for the sequence number field is invalid.Thus, for some embodiments, it may be possible to include error/validitychecking in the step 162 or possibly make error/validity checking aseparate step. Such an error may be handled in any appropriate fashion,which may include providing a message to a user.

If it is determined at the step 162 that the value in the sequencenumber field of the slot equals the current sequence number N, then nospecial processing is required and control transfers from the step 162to the step 156, discussed above, where the data is written to the slot.Otherwise, if the value of the sequence number field is N−1 (the onlyother valid value), then control transfers from the step 162 to a step164 where a new slot is obtained. The new slot obtained at the step 164may be used to store the data being written.

Following the step 164 is a step 166 where the data from the old slot iscopied to the new slot that was obtained at the step 164. Note that thatthe copied data includes the RDF_WP flag, which should have been set atthe step 154 on a previous write when the slot was first created.Following the step 166 is a step 168 where the cache stamp for the newslot is set by setting the password field to the appropriate value,setting the sequence number field to the current sequence number, N, andsetting the pointer field to point to the old slot. Following the step168 is a step 172 where a pointer to the new slot is added to the activeone of the linked lists 74, 76. Following the step 172 is the step 156,discussed above, where the data is written to the slot which, in thiscase, is the new slot.

Referring to FIG. 6, a flow chart 200 illustrates steps performed inconnection with the RA's 30 a-30 c scanning the inactive one of thelists 72, 74 to transmit RDF data from the local storage device 24 tothe remote storage device 26. As discussed above, the inactive one ofthe lists 72, 74 points to slots corresponding to the N−1 cycle for theR1 device when the N cycle is being written to the R1 device by the hostusing the active one of the lists 72, 74.

Processing begins at a first step 202 where it is determined if thereare any entries in the inactive one of the lists 72, 74. As data istransmitted, the corresponding entries are removed from the inactive oneof the lists 72, 74. In addition, new writes are provided to the activeone of the lists 72, 74 and not generally to the inactive one of thelists 72, 74. Thus, it is possible (and desirable, as describedelsewhere herein) for the inactive one of the lists 72, 74 to contain nodata at certain times. If it is determined at the step 202 that there isno data to be transmitted, then the inactive one of the lists 72, 74 iscontinuously polled until data becomes available. Data for sendingbecomes available in connection with a cycle switch (discussed elsewhereherein) where the inactive one of the lists 72, 74 becomes the activeone of the lists 72, 74, and vice versa.

If it is determined at the step 202 that there is data available forsending, control transfers from the step 202 to a step 204, where theslot is verified as being correct. The processing performed at the step204 is an optional “sanity check” that may include verifying that thepassword field is correct and verifying that the sequence number fieldis correct. If there is incorrect (unexpected) data in the slot, errorprocessing may be performed, which may include notifying a user of theerror and possibly error recovery processing.

Following the step 204 is a step 212, where the data is sent via RDF ina conventional fashion. In an embodiment herein, the entire slot is nottransmitted. Rather, only records within the slot that have theappropriate mirror bits set (indicating the records have changed) aretransmitted to the remote storage device 26. However, in otherembodiments, it may be possible to transmit the entire slot, providedthat the remote storage device 26 only writes data corresponding torecords having appropriate mirror bits set and ignores other data forthe track, which may or may not be valid. Following the step 212 is atest step 214 where it is determined if the data that was transmittedhas been acknowledged by the R2 device. If not, the data is resent, asindicated by the flow from the step 214 back to the step 212. In otherembodiments, different and more involved processing may used to senddata and acknowledge receipt thereof. Such processing may include errorreporting and alternative processing that is performed after a certainnumber of attempts to send the data have failed.

Once it is determined at the test step 214 that the data has beensuccessfully sent, control passes from the step 214 to a step 216 toclear the RDF_WP flag (since the data has been successfully sent viaRDF). Following the step 216 is a test step 218 where it is determinedif the slot is a duplicate slot created in connection with a write to aslot already having an existing entry in the inactive one of the lists72, 74. This possibility is discussed above in connection with the steps162, 164, 166, 168, 172. If it is determined at the step 218 that theslot is a duplicate slot, then control passes from the step 218 to astep 222 where the slot is returned to the pool of available slots (tobe reused). In addition, the slot may also be aged (or have some otherappropriate mechanism applied thereto) to provide for immediate reuseahead of other slots since the data provided in the slot is not validfor any other purpose. Following the step 222 or the step 218 if theslot is not a duplicate slot is a step 224 where the password field ofthe slot header is cleared so that when the slot is reused, the test atthe step 146 of FIG. 5 properly classifies the slot as a new slot.

Following the step 224 is a step 226 where the entry in the inactive oneof the lists 72, 74 is removed. Following the step 226, controltransfers back to the step 202, discussed above, where it is determinedif there are additional entries on the inactive one of the lists 72, 74corresponding to data needing to be transferred.

Referring to FIG. 7, a diagram 240 illustrates creation and manipulationof the chunks 56, 58 used by the remote storage device 26. Data that isreceived by the remote storage device 26, via the link 29, is providedto a cache 242 of the remote storage device 26. The cache 242 may beprovided, for example, in the memory 38 of the remote storage device 26.The cache 242 includes a plurality of cache slots 244-246, each of whichmay be mapped to a track of a standard logical storage device 252. Thecache 242 is similar to the cache 88 of FIG. 3 and may contain data thatcan be destaged to the standard logical storage device 252 of the remotestorage device 26. The standard logical storage device 252 correspondsto the data element 62 shown in FIG. 2 and the disks 34 a-34 c shown inFIG. 1.

The remote storage device 26 also contains a pair of cache only virtualdevices 254, 256. The cache only virtual devices 254, 256 correspondeddevice tables that may be stored, for example, in the memory 38 of theremote storage device 26. Each track entry of the tables of each of thecache only virtual devices 254, 256 point to either a track of thestandard logical device 252 or point to a slot of the cache 242. Cacheonly virtual devices are described in a copending U.S. patentapplication titled CACHE-ONLY VIRTUAL DEVICE THAT USES VOLATILE MEMORY,filed on Mar. 25, 2003 (pending) and having Ser. No. 10/396,800, whichis incorporated by reference herein.

The plurality of cache slots 244-246 may be used in connection to writesto the standard logical device 252 and, at the same time, used inconnection with the cache only virtual devices 254, 256. In anembodiment herein, each of track table entry of the cache only virtualdevices 254, 256 contain a null to indicate that the data for that trackis stored on a corresponding track of the standard logical device 252.Otherwise, an entry in the track table for each of the cache onlyvirtual devices 254, 256 contains a pointer to one of the slots 244-246in the cache 242.

Each of the cache only virtual devices 254, 256 corresponds to one ofthe data chunks 56, 58. Thus, for example, the cache only virtual device254 may correspond to the data chunk 56 while the cache only virtualdevice 256 may correspond to the data chunk 58. In an embodiment herein,one of the cache only virtual devices 254, 256 may be deemed “active”while the other one of the cache only virtual devices 254, 256 may bedeemed “inactive”. The inactive one of the cache only virtual devices254, 256 may correspond to data being received from the local storagedevice 24 (i.e., the chunk 56) while the active one of the cache onlyvirtual device 254, 256 corresponds to data being restored (written) tothe standard logical device 252.

Data from the local storage device 24 that is received via the link 29may be placed in one of the slots 244-246 of the cache 242. Acorresponding pointer of the inactive one of the cache only virtualdevices 254, 256 may be set to point to the received data. Subsequentdata having the same sequence number may be processed in a similarmanner. At some point, the local storage device 24 provides a messagecommitting all of the data sent using the same sequence number. Once thedata for a particular sequence number has been committed, the inactiveone of the cache only virtual devices 254, 256 becomes active and viceversa. At that point, data from the now active one of the cache onlyvirtual devices 254, 256 is copied to the standard logical device 252while the inactive one of the cache only virtual devices 254, 256 isused to receive new data (having a new sequence number) transmitted fromthe local storage device 24 to the remote storage device 26.

As data is removed from the active one of the cache only virtual devices254, 256 (discussed elsewhere herein), the corresponding entry in theactive one of the cache only virtual devices 254, 256 may be set tonull. In addition, the data may also be removed from the cache 244(i.e., the slot returned to the pool of free slots for later use)provided that the data in the slot is not otherwise needed for anotherpurpose (e.g., to be destaged to the standard logical device 252). Amechanism may be used to ensure that data is not removed from the cache242 until all mirrors (including the cache only virtual devices 254,256) are no longer using the data. Such a mechanism is described, forexample, in U.S. Pat. No. 5,537,568 issued on Jul. 16, 1996 and in U.S.patent application Ser. No. 09/850,551 filed on Jul. 7, 2001, both ofwhich are incorporated by reference herein.

In some embodiments discussed elsewhere herein, the remote storagedevice 26 may maintain linked lists 258, 262 like the lists 74, 76 usedby the local storage device 24. The lists 258, 262 may containinformation that identifies the slots of the corresponding cache onlyvirtual devices 254, 256 that have been modified, where one of the lists258, 262 corresponds to one of the cache only virtual devices 254, 256and the other one of the lists 258, 262 corresponds to the other one ofthe cache only virtual devices 254, 256. As discussed elsewhere herein,the lists 258, 262 may be used to facilitate restoring data from thecache only virtual devices 254, 256 to the standard logical device 252.

Referring to FIG. 8, a flow chart 270 illustrates steps performed by theremote storage device 26 in connection with processing data for asequence number commit transmitted by the local storage device 24 to theremote storage device 26. As discussed elsewhere herein, the localstorage device 24 periodically increments sequence numbers. When thisoccurs, the local storage device 24 finishes transmitting all of thedata for the previous sequence number and then sends a commit messagefor the previous sequence number.

Processing begins at a first step 272 where the commit is received.Following the step 272 is a test step 274 which determines if the activeone of the cache only virtual devices 254, 256 of the remote storagedevice 26 is empty. As discussed elsewhere herein, the inactive one ofthe cache only virtual devices 254, 256 of the remote storage device 26is used to accumulate data from the local storage device 24 sent usingRDF while the active one of the cache only virtual devices 254, 256 isrestored to the standard logical device 252.

If it is determined at the test step 274 that the active one of thecache only virtual devices 254, 256 is not empty, then control transfersfrom the test step 274 to a step 276 where the restore for the activeone of the cache only virtual devices 254, 256 is completed prior tofurther processing being performed. Restoring data from the active oneof the cache only virtual devices 254, 256 is described in more detailelsewhere herein. It is useful that the active one of the cache onlyvirtual devices 254, 256 is empty prior to handling the commit andbeginning to restore data for the next sequence number.

Following the step 276 or following the step 274 if the active one ofthe cache only virtual devices 254, 256 is determined to be empty, is astep 278 where the active one of the cache only virtual devices 254, 256is made inactive. Following the step 278 is a step 282 where thepreviously inactive one of the cache only virtual devices 254, 256(i.e., the one that was inactive prior to execution of the step 278) ismade active. Swapping the active and inactive cache only virtual devices254, 256 at the steps 278, 282 prepares the now inactive (and empty) oneof the cache only virtual devices 254, 256 to begin to receive data fromthe local storage device 24 for the next sequence number.

Following the step 282 is a step 284 where the active one of the cacheonly virtual devices 254, 256 is restored to the standard logical device252 of the remote storage device 26. Restoring the active one of thecache only virtual devices 254, 256 to the standard logical device 252is described in more detail hereinafter. However, note that, in someembodiments, the restore process is begun, but not necessarilycompleted, at the step 284. Following the step 284 is a step 286 wherethe commit that was sent from the local storage device 24 to the remotestorage device 26 is acknowledged back to the local storage device 24 sothat the local storage device 24 is informed that the commit wassuccessful. Following the step 286, processing is complete.

Referring to FIG. 9, a flow chart 300 illustrates in more detail thesteps 276, 284 of FIG. 8 where the remote storage device 26 restores theactive one of the cache only virtual devices 254, 256. Processing beginsat a first step 302 where a pointer is set to point to the first slot ofthe active one of the cache only virtual devices 254, 256. The pointeris used to iterate through each track table entry of the active one ofthe cache only virtual devices 254, 256, each of which is processedindividually. Following the step 302 is a test step 304 where it isdetermined if the track of the active one of the cache only virtualdevices 254, 256 that is being processed points to the standard logicaldevice 252. If so, then there is nothing to restore. Otherwise, controltransfers from the step 304 to a step a 306 where the corresponding slotof the active one of the cache only virtual devices 254, 256 is locked.

Following the step 306 is a test step 308 which determines if thecorresponding slot of the standard logical device 252 is already in thecache of the remote storage device 26. If so, then control transfersfrom the test step 308 to a step 312 where the slot of the standardlogical device is locked. Following step 312 is a step 314 where thedata from the active one of the cache only virtual devices 254, 256 ismerged with the data in the cache for the standard logical device 252.Merging the data at the step 314 involves overwriting the data for thestandard logical device with the new data of the active one of the cacheonly virtual devices 254, 256. Note that, in embodiments that providefor record level flags, it may be possible to simply OR the new recordsfrom the active one of the cache only virtual devices 254, 256 to therecords of the standard logical device 252 in the cache. That is, if therecords are interleaved, then it is only necessary to use the recordsfrom the active one of the cache only virtual devices 254, 256 that havechanged and provide the records to the cache slot of the standardlogical device 252. Following step 314 is a step 316 where the slot ofthe standard logical device 252 is unlocked. Following step 316 is astep 318 where the slot of the active one of the cache only virtualdevices 254, 256 that is being processed is also unlocked.

If it is determined at the test step 308 that the corresponding slot ofthe standard logical device 252 is not in cache, then control transfersfrom the test step 308 to a step 322 where the track entry for the slotof the standard logical device 252 is changed to indicate that the slotof the standard logical device 252 is in cache (e.g., an IN_CACHE flagmay be set) and needs to be destaged. As discussed elsewhere herein, insome embodiments, only records of the track having appropriate mirrorbits set may need to be destaged. Following the step 322 is a step 324where a flag for the track may be set to indicate that the data for thetrack is in the cache.

Following the step 324 is a step 326 where the slot pointer for thestandard logical device 252 is changed to point to the slot in thecache. Following the step 326 is a test step 328 which determines if theoperations performed at the steps 322, 324, 326 have been successful. Insome instances, a single operation called a “compare and swap” operationmay be used to perform the steps 322, 324, 326. If these operations arenot successful for any reason, then control transfers from the step 328back to the step 308 to reexamine if the corresponding track of thestandard logical device 252 is in the cache. Otherwise, if it isdetermined at the test step 328 that the previous operations have beensuccessful, then control transfers from the test step 328 to the step318, discussed above.

Following the step 318 is a test step 332 which determines if the cacheslot of the active one of the cache only virtual devices 254, 256 (whichis being restored) is still being used. In some cases, it is possiblethat the slot for the active one of the cache only virtual devices 254,256 is still being used by another mirror. If it is determined at thetest step 332 that the slot of the cache only virtual device is notbeing used by another mirror, then control transfers from the test step332 to a step 334 where the slot is released for use by other processes(e.g., restored to pool of available slots, as discussed elsewhereherein). Following the step 334 is a step 336 to point to the next slotto process the next slot of the active one of the cache only virtualdevices 254, 256. Note that the step 336 is also reached from the teststep 332 if it is determined at the step 332 that the active one of thecache only virtual devices 254, 256 is still being used by anothermirror. Note also that the step 336 is reached from the test step 304 ifit is determined at the step 304 that, for the slot being processed, theactive one of the cache only virtual devices 254, 256 points to thestandard logical device 252. Following the step 336 is a test step 338which determines if there are more slots of the active one of the cacheonly virtual devices 254, 256 to be processed. If not, processing iscomplete. Otherwise, control transfers from the test step 338 back tothe step 304.

In another embodiment, it is possible to construct lists of modifiedslots for the received chunk of data 56 corresponding to the N−1 cycleon the remote storage device 26, such as the lists 258, 262 shown inFIG. 7. As the data is received, the remote storage device 26 constructsa linked list of modified slots. The lists that are constructed may becircular, linear (with a NULL termination), or any other appropriatedesign. The lists may then be used to restore the active one of thecache only virtual devices 254, 256.

The flow chart 300 of FIG. 9 shows two alternative paths 342, 344 thatillustrate operation of embodiments where a list of modified slots isused. At the step 302, a pointer (used for iterating through the list ofmodified slots) is made to point to the first element of the list.Following the step 302 is the step 306, which is reached by thealternative path 342. In embodiments that use lists of modified slots,the test step 304 is not needed since no slots on the list should pointto the standard logical device 252.

Following the step 306, processing continues as discussed above with theprevious embodiment, except that the step 336 refers to traversing thelist of modified slots rather than pointing to the next slot in theCOVD. Similarly, the test at the step 338 determines if the pointer isat the end of the list (or back to the beginning in the case of acircular linked list). Also, if it is determined at the step 338 thatthere are more slots to process, then control transfers from the step338 to the step 306, as illustrated by the alternative path 344. Asdiscussed above, for embodiments that use a list of modified slots, thestep 304 may be eliminated.

Referring to FIG. 10, a flow chart 350 illustrates steps performed inconnection with the local storage device 24 increasing the sequencenumber. Processing begins at a first step 352 where the local storagedevice 24 waits at least M seconds prior to increasing the sequencenumber. In an embodiment herein, M is thirty, but of course M could beany number. Larger values for M increase the amount of data that may belost if communication between the storage devices 24, 26 is disrupted.However, smaller values for M increase the total amount of overheadcaused by incrementing the sequence number more frequently.

Following the step 352 is a test step 354 which determines if all of theHA's of the local storage device 24 have set a bit indicating that theHA's have completed all of the I/O's for a previous sequence number.When the sequence number changes, each of the HA's notices the changeand sets a bit indicating that all I/O's of the previous sequence numberare completed. For example, if the sequence number changes from N−1 toN, an HA will set the bit when the HA has completed all I/O's forsequence number N−1. Note that, in some instances, a single I/O for anHA may take a long time and may still be in progress even after thesequence number has changed. Note also that, for some systems, adifferent mechanism may be used to determine if all of the HA's havecompleted their N−1 I/O's. The different mechanism may include examiningdevice tables in the memory 37.

If it is determined at the test step 354 that I/O's from the previoussequence number have been completed, then control transfers from thestep 354 to a test step 356 which determines if the inactive one of thelists 74, 76 is empty. Note that a sequence number switch may not bemade unless and until all of the data corresponding to the inactive oneof the lists 74, 76 has been completely transmitted from the localstorage device 24 to the remote storage device 26 using the RDFprotocol. Once the inactive one of the lists 74, 76 is determined to beempty, then control transfers from the step 356 to a step 358 where thecommit for the previous sequence number is sent from the local storagedevice 24 to the remote storage device 26. As discussed above, theremote storage device 26 receiving a commit message for a particularsequence number will cause the remote storage device 26 to beginrestoring the data corresponding to the sequence number.

Following the step 358 is a step 362 where the copying of data for theinactive one of the lists 74, 76 is suspended. As discussed elsewhereherein, the inactive one of the lists is scanned to send correspondingdata from the local storage device 24 to the remote storage device 26.It is useful to suspend copying data until the sequence number switch iscompleted. In an embodiment herein, the suspension is provided bysending a message to the RA's 30 a-30 c. However, it will be appreciatedby one of ordinary skill in the art that for embodiments that use othercomponents to facilitate sending data using the system described herein,suspending copying may be provided by sending appropriatemessages/commands to the other components.

Following step 362 is a step 364 where the sequence number isincremented. Following step 364 is a step 366 where the bits for theHA's that are used in the test step 354 are all cleared so that the bitsmay be set again in connection with the increment of the sequencenumber. Following step 366 is a test step 372 which determines if theremote storage device 26 has acknowledged the commit message sent at thestep 358. Acknowledging the commit message is discussed above inconnection with FIG. 8. Once it is determined that the remote storagedevice 26 has acknowledged the commit message sent at the step 358,control transfers from the step 372 to a step 374 where the suspensionof copying, which was provided at the step 362, is cleared so thatcopying may resume. Following step 374, processing is complete. Notethat it is possible to go from the step 374 back to the step 352 tobegin a new cycle to continuously increment the sequence number.

It is also possible to use COVD's on the R1 device to collect slotsassociated with active data and inactive chunks of data. In that case,just as with the R2 device, one COVD could be associated with theinactive sequence number and another COVD could be associated with theactive sequence number. This is described below.

Referring to FIG. 11, a diagram 400 illustrates items used to constructand maintain the chunks 52, 54. A standard logical device 402 containsdata written by the host 22 and corresponds to the data element 51 ofFIG. 2 and the disks 33 a-33 c of FIG. 1. The standard logical device402 contains data written by the host 22 to the local storage device 24.

Two cache only virtual devices 404, 406 are used in connection with thestandard logical device 402. The cache only virtual devices 404, 406corresponded device tables that may be stored, for example, in thememory 37 of the local storage device 24. Each track entry of the tablesof each of the cache only virtual devices 404, 406 point to either atrack of the standard logical device 402 or point to a slot of a cache408 used in connection with the local storage device 24. In someembodiments, the cache 408 may be provided in the memory 37 of the localstorage device 24.

The cache 408 contains a plurality of cache slots 412-414 that may beused in connection to writes to the standard logical device 402 and, atthe same time, used in connection with the cache only virtual devices404, 406. In an embodiment herein, each track table entry of the cacheonly virtual devices 404, 406 contains a null to point to acorresponding track of the standard logical device 402. Otherwise, anentry in the track table for each of the cache only virtual devices 404,406 contains a pointer to one of the slots 412-414 in the cache 408.

Each of the cache only virtual devices 404, 406 may be used for one ofthe chunks of data 52, 54 so that, for example, the cache only virtualdevice 404 may correspond to the chunk of data 52 for sequence number Nwhile the cache only virtual device 406 may correspond to the chunk ofdata 54 for sequence number N−1. Thus, when data is written by the host22 to the local storage device 24, the data is provided to the cache 408and an appropriate pointer of the cache only virtual device 404 isadjusted. Note that the data will not be removed from the cache 408until the data is destaged to the standard logical device 402 and thedata is also released by the cache only virtual device 404, as describedelsewhere herein.

In an embodiment herein, one of the cache only virtual devices 404, 406is deemed “active” while the other is deemed “inactive”. Thus, forexample, when the sequence number N is even, the cache only virtualdevice 404 may be active while the cache only virtual device 406 isinactive. The active one of the cache only virtual devices 404, 406handles writes from the host 22 while the inactive one of the cache onlyvirtual devices 404, 406 corresponds to the data that is beingtransmitted from the local storage device 24 to the remote storagedevice 26.

While the data that is written by the host 22 is accumulated using theactive one of the cache only virtual devices 404, 406 (for the sequencenumber N), the data corresponding to the inactive one of the cache onlyvirtual devices 404, 406 (for previous sequence number N−1) istransmitted from the local storage device 24 to the remote storagedevice 26. For this and related embodiments, the DA's 35 a-35 c of thelocal storage device handle scanning the inactive one of the cache onlyvirtual devices 404, 406 to send copy requests to one or more of theRA's 30 a-30 c to transmit the data from the local storage device 24 tothe remote storage device 26. Thus, the steps 362, 374, discussed abovein connection with suspending and resuming copying, may includeproviding messages/commands to the DA's 35 a-35 c.

Once the data has been transmitted to the remote storage device 26, thecorresponding entry in the inactive one of the cache only virtualdevices 404, 406 may be set to null. In addition, the data may also beremoved from the cache 408 (i.e., the slot returned to the pool of slotsfor later use) if the data in the slot is not otherwise needed foranother purpose (e.g., to be destaged to the standard logical device402). A mechanism may be used to ensure that data is not removed fromthe cache 408 until all mirrors (including the cache only virtualdevices 404, 406) are no longer using the data. Such a mechanism isdescribed, for example, in U.S. Pat. No. 5,537,568 issued on Jul. 16,1996 and in U.S. patent application Ser. No. 09/850,551 filed on Jul. 7,2001, both of which are incorporated by reference herein.

Referring to FIG. 12, a flow chart 440 illustrates steps performed bythe HA 28 in connection with a host 22 performing a write operation forembodiments where two COVD's are used by the R1 device to provide thesystem described herein. Processing begins at a first step 442 where aslot corresponding to the write is locked. In an embodiment herein, eachof the slots 412-414 of the cache 408 corresponds to a track of data onthe standard logical device 402. Locking the slot at the step 442prevents additional processes from operating on the relevant slot duringthe processing performed by the HA 28 corresponding to the steps of theflow chart 440.

Following the step 442 is a step 444 where a value for N, the sequencenumber, is set. Just as with the embodiment that uses lists rather thanCOVD's on the R1 side, the value for the sequence number obtained at thestep 444 is maintained during the entire write operation performed bythe HA 28 while the slot is locked. As discussed elsewhere herein, thesequence number is assigned to each write to set the one of the chunksof data 52, 54 to which the write belongs. Writes performed by the host22 are assigned the current sequence number. It is useful that a singlewrite operation maintain the same sequence number throughout.

Following the step 444 is a test step 446, which determines if theinactive one of the cache only virtual devices 404, 406 already pointsto the slot that was locked at the step 442 (the slot being operatedupon). This may occur if a write to the same slot was provided when thesequence number was one less than the current sequence number. The datacorresponding to the write for the previous sequence number may not yethave been transmitted to the remote storage device 26.

If it is determined at the test step 446 that the inactive one of thecache only virtual devices 404, 406 does not point to the slot, thencontrol transfers from the test step 446 to another test step 448, whereit is determined if the active one of the cache only virtual devices404, 406 points to the slot. It is possible for the active one of thecache only virtual devices 404, 406 to point to the slot if there hadbeen a previous write to the slot while the sequence number was the sameas the current sequence number. If it is determined at the test step 448that the active one of the cache only virtual devices 404, 406 does notpoint to the slot, then control transfers from the test step 448 to astep 452 where a new slot is obtained for the data. Following the step452 is a step 454 where the active one of the cache only virtual devices404, 406 is made to point to the slot.

Following the step 454, or following the step 448 if the active one ofthe cache only virtual devices 404, 406 points to the slot, is a step456 where flags are set. At the step 456, the RDF_WP flag (RDF writepending flag) is set to indicate that the slot needs to be transmittedto the remote storage device 26 using RDF. In addition, at the step 456,the IN_CACHE flag is set to indicate that the slot needs to be destagedto the standard logical device 402. Note that, in some instances, if theactive one of the cache only virtual devices 404, 406 already points tothe slot (as determined at the step 448) it is possible that the RDF_WPand IN_CACHE flags were already set prior to execution of the step 456.However, setting the flags at the step 456 ensures that the flags areset properly no matter what the previous state.

Following the step 456 is a step 458 where an indirect flag in the tracktable that points to the slot is cleared, indicating that the relevantdata is provided in the slot and not in a different slot indirectlypointed to. Following the step 458 is a step 462 where the data beingwritten by the host 22 and the HA 28 is written to the slot. Followingthe step 462 is a step 464 where the slot is unlocked. Following step464, processing is complete.

If it is determined at the test step 446 that the inactive one of thecache only virtual devices 404, 406 points to the slot, then controltransfers from the step 446 to a step 472, where a new slot is obtained.The new slot obtained at the step 472 may be used for the inactive oneof the cache only virtual devices 404, 406 to effect the RDF transferwhile the old slot may be associated with the active one of the cacheonly virtual devices 404, 406, as described below.

Following the step 472 is a step 474 where the data from the old slot iscopied to the new slot that was obtained at the step 472. Following thestep 474 is a step 476 where the indirect flag (discussed above) is setto indicate that the track table entry for the inactive one of the cacheonly virtual devices 404, 406 points to the old slot but that the datais in the new slot which is pointed to by the old slot. Thus, settingindirect flag at the step 476 affects the track table of the inactiveone of the cache only virtual devices 404, 406 to cause the track tableentry to indicate that the data is in the new slot.

Following the step 476 is a step 478 where the mirror bits for therecords in the new slot are adjusted. Any local mirror bits that werecopied when the data was copied from the old slot to the new slot at thestep 474 are cleared since the purpose of the new slot is to simplyeffect the RDF transfer for the inactive one of the cache only virtualdevices. The old slot will be used to handle any local mirrors.Following the step 478 is the step 462 where the data is written to theslot. Following step 462 is the step 464 where the slot is unlocked.Following the step 464, processing is complete.

Referring to FIG. 13, a flow chart 500 illustrates steps performed inconnection with the local storage device 24 transmitting the chunk ofdata 54 to the remote storage device 26. The transmission essentiallyinvolves scanning the inactive one of the cache only virtual devices404, 406 for tracks that have been written thereto during a previousiteration when the inactive one of the cache only virtual devices 404,406 was active. In this embodiment, the DA's 35 a-35 c of the localstorage device 24 scan the inactive one of the cache only virtualdevices 404, 406 to copy the data for transmission to the remote storagedevice 26 by one or more of the RA's 30 a-30 c using the RDF protocol.

Processing begins at a first step 502 where the first track of theinactive one of the cache only virtual devices 404, 406 is pointed to inorder to begin the process of iterating through all of the tracks.Following the first step 502 is a test step 504 where it is determinedif the RDF_WP flag is set. As discussed elsewhere herein, the RDF_WPflag is used to indicate that a slot (track) contains data that needs tobe transmitted via the RDF link. The RDF_WP flag being set indicatesthat at least some data for the slot (track) is to be transmitted usingRDF. In an embodiment herein, the entire slot is not transmitted.Rather, only records within the slot that have the appropriate mirrorbits set (indicating the records have changed) are transmitted to theremote storage device 26. However, in other embodiments, it may bepossible to transmit the entire slot, provided that the remote storagedevice 26 only writes data corresponding to records having appropriatemirror bits set and ignores other data for the track, which may or maynot be valid.

If it is determined at the test step 504 that the cache slot beingprocessed has the RDF_WP flag set, then control transfers from the step504 to a test step 505, where it is determined if the slot contains thedata or if the slot is an indirect slot that points to another slot thatcontains the relevant data. In some instances, a slot may not containthe data for the portion of the disk that corresponds to the slot.Instead, the slot may be an indirect slot that points to another slotthat contains the data. If it is determined at the step 505 that theslot is an indirect slot, then control transfers from the step 505 to astep 506, where the data (from the slot pointed to by the indirect slot)is obtained. Thus, if the slot is a direct slot, the data for being sentby RDF is stored in the slot while if the slot is an indirect slot, thedata for being sent by RDF is in another slot pointed to by the indirectslot.

Following the step 506 or the step 505 if the slot is a direct slot is astep 507 where data being sent (directly or indirectly from the slot) iscopied by one of the DA's 35 a-35 c to be sent from the local storagedevice 24 to the remote storage device 26 using the RDF protocol.Following the step 507 is a test step 508 where it is determined if theremote storage device 26 has acknowledged receipt of the data. If not,then control transfers from the step 508 back to the step 507 to resendthe data. In other embodiments, different and more involved processingmay used to send data and acknowledge receipt thereof. Such processingmay include error reporting and alternative processing that is performedafter a certain number of attempts to send the data have failed.

Once it is determined at the test step 508 that the data has beensuccessfully sent, control passes from the step 508 to a step 512 toclear the RDF_WP flag (since the data has been successfully sent viaRDF). Following the step 512 is a step 514 where appropriate mirrorflags are cleared to indicate that at least the RDF mirror (R2) nolonger needs the data. In an embodiment herein, each record that is partof a slot (track) has individual mirror flags indicating which mirrorsuse the particular record. The R2 device is one of the mirrors for eachof the records and it is the flags corresponding to the R2 device thatare cleared at the step 514.

Following the step 514 is a test step 516 which determines if any of therecords of the track being processed have any other mirror flags set(for other mirror devices). If not, then control passes from the step516 to a step 518 where the slot is released (i.e., no longer beingused). In some embodiments, unused slots are maintained in a pool ofslots available for use. Note that if additional flags are still set forsome of the records of the slot, it may mean that the records need to bedestaged to the standard logical device 402 or are being used by someother mirror (including another R2 device). Following the step 518, orfollowing the step 516 if more mirror flags are present, is a step 522where the pointer that is used to iterate through each track entry ofthe inactive one of the cache only virtual devices 404, 406 is made topoint to the next track. Following the step 522 is a test step 524 whichdetermines if there are more tracks of the inactive one of the cacheonly virtual devices 404, 406 to be processed. If not, then processingis complete. Otherwise, control transfers back to the test step 504,discussed above. Note that the step 522 is also reached from the teststep 504 if it is determined that the RDF_WP flag is not set for thetrack being processed.

Referring to FIG. 14, a diagram 700 illustrates a host 702 coupled to aplurality of local storage devices 703-705. The diagram 700 also shows aplurality of remote storage devices 706-708. Although only three localstorage devices 703-705 and three remote storage devices 706-708 areshown in the diagram 700, the system described herein may be expanded touse any number of local and remote storage devices.

Each of the local storage devices 703-705 is coupled to a correspondingone of the remote storage devices 706-708 so that, for example, thelocal storage device 703 is coupled to the remote storage device 706,the local storage device 704 is coupled to the remote storage device 707and the local storage device 705 is coupled to the remote storage device708. The local storage device is 703-705 and remote storage device is706-708 may be coupled using the ordered writes mechanism describedherein so that, for example, the local storage device 703 may be coupledto the remote storage device 706 using the ordered writes mechanism. Asdiscussed elsewhere herein, the ordered writes mechanism allows datarecovery using the remote storage device in instances where the localstorage device and/or host stops working and/or loses data.

In some instances, the host 702 may run a single application thatsimultaneously uses more than one of the local storage devices 703-705.In such a case, the application may be configured to insure thatapplication data is consistent (recoverable) at the local storagedevices 703-705 if the host 702 were to cease working at any time and/orif one of the local storage devices 703-705 were to fail. However, sinceeach of the ordered write connections between the local storage devices703-705 and the remote storage devices 706-708 is asynchronous from theother connections, then there is no assurance that data for theapplication will be consistent (and thus recoverable) at the remotestorage devices 706-708. That is, for example, even though the dataconnection between the local storage device 703 and the remote storagedevice 706 (a first local/remote pair) is consistent and the dataconnection between the local storage device 704 and the remote storagedevice 707 (a second local/remote pair) is consistent, it is notnecessarily the case that the data on the remote storage devices 706,707 is always consistent if there is no synchronization between thefirst and second local/remote pairs.

For applications on the host 702 that simultaneously use a plurality oflocal storage devices 703-705, it is desirable to have the data beconsistent and recoverable at the remote storage devices 706-708. Thismay be provided by a mechanism whereby the host 702 controls cycleswitching at each of the local storage devices 703-705 so that the datafrom the application running on the host 702 is consistent andrecoverable at the remote storage devices 706-708. This functionality isprovided by a special application that runs on the host 702 thatswitches a plurality of the local storage devices 703-705 into multi-boxmode, as described in more detail below.

Referring to FIG. 15, a table 730 has a plurality of entries 732-734.Each of the entries 732-734 correspond to a single local/remote pair ofstorage devices so that, for example, the entry 732 may correspond topair of the local storage device 703 and the remote storage device 706,the entry 733 may correspond to pair of the local storage device 704 andthe remote storage device 707 and the entry 734 may correspond to thepair of local storage device 705 and the remote storage device 708. Eachof the entries 732-734 has a plurality of fields where a first field 736a-736 c represents a serial number of the corresponding local storagedevice, a second field 738 a-738 c represents a session number used bythe multi-box group, a third field 742 a-742 c represents the serialnumber of the corresponding remote storage device of the local/remotepair, and a fourth field 744 a-744 c represents the session number forthe multi-box group. The table 730 is constructed and maintained by thehost 702 in connection with operating in multi-box mode. In addition,the table 730 is propagated to each of the local storage devices and theremote storage devices that are part of the multi-box group. The table730 may be used to facilitate recovery, as discussed in more detailbelow.

Different local/remote pairs may enter and exit multi-box modeindependently in any sequence and at any time. The host 702 managesentry and exit of local storage device/remote storage device pairs intoand out of multi-box mode. This is described in more detail below.

Referring to FIG. 16, a flowchart 750 illustrates steps performed by thehost 702 in connection with entry or exit of a local/remote pair in toor out of multi-box mode. Processing begins at a first step 752 wheremulti-box mode operation is temporarily suspended. Temporarilysuspending multi-box operation at the step 752 is useful to facilitatethe changes that are made in connection with entry or exit of aremote/local pair in to or out of multi-box mode. Following the step752, is a step 754 where a table like the table 730 of FIG. 15 ismodified to either add or delete an entry, as appropriate. Following thestep 754 is a step 756 where the modified table is propagated to thelocal storage devices and remote storage devices of the multi-box group.Propagating the table at the step 756 facilitates recovery, as discussedin more detail elsewhere herein.

Following the step 756 is a step 758 where a message is sent to theaffected local storage device to provide the change. The local storagedevice may configure itself to run in multi-box mode or not, asdescribed in more detail elsewhere herein. As discussed in more detailbelow, a local storage device handling ordered writes operatesdifferently depending upon whether it is operating as part of amulti-box group or not. If the local storage device is being added to amulti-box group, the message sent at the step 758 indicates to the localstorage device that it is being added to a multi-box group so that thelocal storage device should configure itself to run in multi-box mode.Alternatively, if a local storage device is being removed from amulti-box group, the message sent at the step 758 indicates to the localstorage device that it is being removed from the multi-box group so thatthe local storage device should configure itself to not run in multi-boxmode.

Following step 758 is a test step 762 where it is determined if alocal/remote pair is being added to the multi-box group (as opposed tobeing removed). If so, then control transfers from the test step 762 toa step 764 where tag values are sent to the local storage device that isbeing added. The tag values are provided with the data transmitted fromthe local storage device to the remote storage device in a mannersimilar to providing the sequence numbers with the data. The tag valuesare controlled by the host and set so that all of the local/remote pairssend data having the same tag value during the same cycle. Use of thetag values is discussed in more detail below. Following the step 764, orfollowing the step 762 if a new local/remote pair is not being added, isa step 766 where multi-box operation is resumed. Following the step 766,processing is complete.

Referring to FIG. 17, a flow chart 780 illustrates steps performed inconnection with the host managing cycle switching for multiplelocal/remote pairs running as a group in multi-box mode. As discussedelsewhere herein, multi-box mode involves having the host synchronizecycle switches for more than one remote/local pair to maintain dataconsistency among the remote storage devices. Cycle switching iscoordinated by the host rather than being generated internally by thelocal storage devices. This is discussed in more detail below.

Processing for the flow chart 780 begins at a test step 782 whichdetermines if M seconds have passed. Just as with non-multi-boxoperation, cycle switches occur no sooner than every M seconds where Mis a number chosen to optimize various performance parameters. As thenumber M is increased, the amount of overhead associated with switchingdecreases. However, increasing M also causes the amount of data that maybe potentially lost in connection with a failure to also increase. In anembodiment herein, M is chosen to be thirty seconds, although, obviouslyother values for M may be used.

If it is determined at the test step 782 that M seconds have not passed,then control transfers back to the step 782 to continue waiting until Mseconds have passed. Once it is determined at the test step 782 that Mseconds have passed, control transfers from the step 782 to a step 784where the host queries all of the local storage devices in the multi-boxgroup to determine if all of the local/remote pairs are ready to switch.The local/remote pairs being ready to switch is discussed in more detailhereinafter.

Following the step 784 is a test step 786 which determines if all of thelocal/remote pairs are ready to switch. If not, control transfers backto the step 784 to resume the query. In an embodiment herein, it is onlynecessary to query local/remote pairs that were previously not ready toswitch since, once a local/remote pair is ready to switch, the pairremains so until the switch occurs.

Once it is determined at the test step 786 that all of the local/remotepairs in the multi-box group are ready to switch, control transfers fromthe step 786 to a step 788 where an index variable, N, is set equal toone. The index variable N is used to iterate through all thelocal/remote pairs (i.e., all of the entries 732-734 of the table 730 ofFIG. 15). Following the step 788 is a test step 792 which determines ifthe index variable, N, is greater than the number of local/remote pairsin the multi-box group. If not, then control transfers from the step 792to a step 794 where an open window is performed for the Nth localstorage device of the Nth pair by the host sending a command (e.g., anappropriate system command) to the Nth local storage device. Opening thewindow for the Nth local storage device at the step 794 causes the Nthlocal storage device to suspend writes so that any write by a host thatis not begun prior to opening the window at the step 794 will not becompleted until the window is closed (described below). Not completing awrite operation prevents a second dependant write from occurring priorto completion of the cycle switch. Any writes in progress that werebegun before opening the window may complete prior to the window beingclosed.

Following the step 794 is a step 796 where a cycle switch is performedfor the Nth local storage device. Performing the cycle switch at thestep 796 involves sending a command from the host 702 to the Nth localstorage device. Processing the command from the host by the Nth localstorage device is discussed in more detail below. Part of the processingperformed at the step 796 may include having the host provide new valuesfor the tags that are assigned to the data. The tags are discussed inmore detail elsewhere herein. In an alternative embodiment, theoperations performed at the steps 794, 796 may be performed as a singleintegrated step 797, which is illustrated by the box drawn around thesteps 794, 796.

Following the step 796 is a step 798 where the index variable, N, isincremented. Following step 798, control transfers back to the test step792 to determine if the index variable, N, is greater than the number oflocal/remote pairs.

If it is determined at the test step 792 that the index variable, N, isgreater than the number of local/remote pairs, then control transfersfrom the test step 792 to a step 802 where the index variable, N, is setequal to one. Following the step 802 is a test step 804 which determinesif the index variable, N, is greater than the number of local/remotepairs. If not, then control transfers from the step 804 to a step 806where the window for the Nth local storage device is closed. Closing thewindow of the step 806 is performed by the host sending a command to theNth local storage device to cause the Nth local storage device to resumewrite operations. Thus, any writes in process that were suspended byopening the window at the step 794 may now be completed after executionof the step 806. Following the step 806, control transfers to a step 808where the index variable, N, is incremented. Following the step 808,control transfers back to the test step 804 to determine if the indexvariable, N, is greater than the number of local/remote pairs. If so,then control transfers from the test step 804 back to the step 782 tobegin processing for the next cycle switch.

Referring to FIG. 18, a flow chart 830 illustrates steps performed by alocal storage device in connection with cycle switching. The flow chart830 of FIG. 18 replaces the flow chart 350 of FIG. 10 in instances wherethe local storage device supports both multi-box mode and non-multi-boxmode. That is, the flow chart 830 shows steps performed like those ofthe flow chart 350 of FIG. 10 to support non-multi-box mode and, inaddition, includes steps for supporting multi-box mode.

Processing begins at a first test step 832 which determines if the localstorage device is operating in multi-box mode. Note that the flow chart750 of FIG. 16 shows the step 758 where the host sends a message to thelocal storage device. The message sent at the step 758 indicates to thelocal storage device whether the local storage device is in multi-boxmode or not. Upon receipt of the message sent by the host at the step758, the local storage device sets an internal variable to indicatewhether the local storage device is operating in multi-box mode or not.The internal variable may be examined at the test step 832.

If it is determined at the test step 832 that the local storage deviceis not in multi-box mode, then control transfers from the test step 832to a step 834 to wait M seconds for the cycle switch. If the localstorage device is not operating in multi-box mode, then the localstorage device controls its own cycle switching and thus executes thestep 834 to wait M seconds before initiating the next cycle switch.

Following the step 834, or following the step 832 if the local storagedevice is in multi-box mode, is a test step 836 which determines if allof the HA's of the local storage device have set a bit indicating thatthe HA's have completed all of the I/O's for a previous sequence number.When the sequence number changes, each of the HA's notices the changeand sets a bit indicating that all I/O's of the previous sequence numberare completed. For example, if the sequence number changes from N−1 toN, an HA will set the bit when the HA has completed all I/O's forsequence number N−1. Note that, in some instances, a single I/O for anHA may take a long time and may still be in progress even after thesequence number has changed. Note also that, for some systems, adifferent mechanism may be used to determine if all HA's have completedtheir N−1 I/O's. The different mechanism may include examining devicetables. Once it is determined at the test step 836 that all HA's haveset the appropriate bit, control transfers from the test step 836 to astep 888 which determines if the inactive chunk for the local storagedevice is empty. Once it is determined at the test step 888 that theinactive chunk is empty, control transfers from the step 888 to a step899, where copying of data from the local storage device to the remotestorage device is suspended. It is useful to suspend copying data untilthe sequence number switch is complete.

Following the step 899 is a test step 892 to determine if the localstorage device is in multi-box mode. If it is determined at the teststep 892 that the local storage device is in multi-box mode, thencontrol transfers from the test step 892 to a test step 894 to determineif the active chunk of the corresponding remote storage device is empty.As discussed in more detail below, the remote storage device sends amessage to the local storage device once it has emptied its activechunk. In response to the message, the local storage device sets aninternal variable that is examined at the test step 894.

Once it is determined at the test step 894 that the active chunk of theremote storage device is empty, control transfers from the test step 894to a step 896 where an internal variable is set on a local storagedevice indicating that the local storage device is ready to switchcycles. As discussed above in connection with the flow chart 780 of FIG.17, the host queries each of the local storage devices to determine ifeach of the local storage devices are ready to switch. In response tothe query provided by the host, the local storage device examines theinternal variable set at the step 896 and returns the result to thehost.

Following step 896 is a test step 898 where the local storage devicewaits to receive the command from the host to perform the cycle switch.As discussed above in connection with the flow chart 780 of FIG. 17, thehost provides a command to switch cycles to the local storage devicewhen the local storage device is operating in multi-box mode. Thus, thelocal storage device waits for the command at the step 898, which isonly reached when the local storage device is operating in multi-boxmode.

Once the local storage device has received the switch command from thehost, control transfers from the step 898 to a step 902 to send a commitmessage to the remote storage device. Note that the step 902 is alsoreached from the test step 892 if it is determined at the step test 892that the local storage device is not in multi-box mode. At the step 902,the local storage device sends a commit message to the remote storagedevice. In response to receiving a commit message for a particularsequence number, the remote storage device will begin restoring the datacorresponding to the sequence number, as discussed above.

Following the step 902 is a step 906 where the sequence number isincremented and a new value for the tag (from the host) is stored. Thesequence number is as discussed above. The tag is the tag provided tothe local storage device at the step 764 and at the step 796, asdiscussed above. The tag is used to facilitate data recovery, asdiscussed elsewhere herein.

Following the step 906 is a step 907 where completion of the cycleswitch is confirmed from the local storage device to the host by sendinga message from the local storage device to the host. In someembodiments, it is possible to condition performing the step 907 onwhether the local storage device is in multi-box mode or not, since, ifthe local storage device is not in multi-box mode, the host is notnecessarily interested in when cycle switches occur.

Following the step 907 is a step 908 where the bits for the HA's thatare used in the test step 836 are all cleared so that the bits may beset again in connection with the increment of the sequence number.Following the step 908 is a test step 912 which determines if the remotestorage device has acknowledged the commit message. Note that if thelocal/remote pair is operating in multi-box mode and the remote storagedevice active chunk was determined to be empty at the step 894, then theremote storage device should acknowledge the commit message nearlyimmediately since the remote storage device will be ready for the cycleswitch immediately because the active chunk thereof is already empty.

Once it is determined at the test step 912 that the commit message hasbeen acknowledged by the remote storage device, control transfers fromthe step 912 to a step 914 where the suspension of copying, which wasprovided at the step 899, is cleared so that copying from the localstorage device to the remote storage device may resume. Following thestep 914, processing is complete.

Referring to FIG. 19, a flow chart 940 illustrates steps performed inconnection with RA's scanning the inactive buffers to transmit RDF datafrom the local storage device to the remote storage device. The flowchart 940 of FIG. 19 is similar to the flow chart 200 of FIG. 6 andsimilar steps are given the same reference number. However, the flowchart 940 includes two additional steps 942, 944 which are not found inthe flow chart 200 of FIG. 6. The additional steps 942, 944 are used tofacilitate multi-box processing. After data has been sent at the step212, control transfers from the step 212 to a test step 942 whichdetermines if the data being sent is the last data in the inactive chunkof the local storage device. If not, then control transfers from thestep 942 to the step 214 and processing continues as discussed above inconnection with the flow chart 200 of FIG. 6. Otherwise, if it isdetermined at the test step 942 that the data being sent is the lastdata of the chunk, then control transfers from the step 942 to the step944 to send a special message from the local storage device to theremote storage device indicating that the last data has been sent.Following the step 944, control transfers to the step 214 and processingcontinues as discussed above in connection with the flow chart 200 ofFIG. 6. In some embodiments, the steps 942, 944 may be performed by aseparate process (and/or separate hardware device) that is differentfrom the process and/or hardware device that transfers the data.

Referring to FIG. 20, a flow chart 950 illustrates steps performed inconnection with RA's scanning the inactive buffers to transmit RDF datafrom the local storage device to the remote storage device. The flowchart 950 of FIG. 20 is similar to the flow chart 500 of FIG. 13 andsimilar steps are given the same reference number. However, the flowchart 950 includes an additional step 952, which is not found in theflow chart 500 of FIG. 13. The additional steps 952 is used tofacilitate multi-box processing and is like the additional step 944 ofthe flowchart 940 of FIG. 19. After it is determined at the test step524 that no more slots remain to be sent from the local storage deviceto the remote storage device, control transfers from the step 524 to thestep 952 to send a special message from the local storage device to theremote storage device indicating that the last data for the chunk hasbeen sent. Following the step 952, processing is complete.

Referring to FIG. 21, a flow chart 960 illustrates steps performed atthe remote storage device in connection with providing an indicationthat the active chunk of the remote storage device is empty. The flowchart 960 is like the flow chart 300 of FIG. 9 except that the flowchart 960 shows a new step 962 that is performed after the active chunkof the remote storage device has been restored. At the step 962, theremote storage device sends a message to the local storage deviceindicating that the active chunk of the remote storage device is empty.Upon receipt of the message sent at the step 962, the local storagedevice sets an internal variable indicating that the inactive buffer ofthe remote storage device is empty. The local variable is examined inconnection with the test step 894 of the flow chart 830 of FIG. 18,discussed above.

Referring to FIG. 22, a diagram 980 illustrates the host 702, localstorage devices 703-705 and remote storage devices 706-708, that areshown in the diagram 700 of FIG. 14. The Diagram 980 also includes afirst alternative host 982 that is coupled to the host 702 and the localstorage devices 703-705. The diagram 980 also includes a secondalternative host 984 that is coupled to the remote storage devices706-708. The alternative hosts 982, 984 may be used for data recovery,as described in more detail below.

When recovery of data at the remote site is necessary, the recovery maybe performed by the host 702 or, by the host 982 provided that the linksbetween the local storage devices 703-705 and the remote storage devices706-708 are still operational. If the links are not operational, thendata recovery may be performed by the second alternative host 984 thatis coupled to the remote storage devices 706-708. The second alternativehost 984 may be provided in the same location as one or more of theremote storage devices 706-708. Alternatively, the second alternativehost 984 may be remote from all of the remote storage devices 706-708.The table 730 that is propagated throughout the system is accessed inconnection with data recovery to determine the members of the multi-boxgroup.

Referring to FIG. 23, a flow chart 1000 illustrates steps performed byeach of the remote storage devices 706-708 in connection with the datarecovery operation. The steps of the flowchart 1000 may be executed byeach of the remote storage devices 706-708 upon receipt of a signal or amessage indicating that data recovery is necessary. In some embodiments,it may be possible for a remote storage device to automatically sensethat data recovery is necessary using, for example, conventionalcriteria such as length of time since last write.

Processing begins at a first step 1002 where the remote storage devicefinishes restoring the active chunk in a manner discussed elsewhereherein. Following the step 1002 is a test step 1004 which determines ifthe inactive chunk of the remote storage device is complete (i.e., allof the data has been written thereto). Note that a remote storage devicemay determine if the inactive chunk is complete using the message sentby the local storage device at the steps 944, 952, discussed above. Thatis, if the local storage device has sent the message at the step 944 orthe step 952, then the remote storage device may use receipt of thatmessage to confirm that the inactive chunk is complete.

If it is determined at the test step 1004 that the inactive chunk of theremote storage device is not complete, then control transfers from thetest step 1004 to a step 1006 where the data from the inactive chunk isdiscarded. No data recovery is performed using incomplete inactivechunks since the data therein may be inconsistent with the correspondingactive chunks. Accordingly, data recovery is performed using activechunks and, in some cases, inactive chunks that are complete. Followingthe step 1006, processing is complete.

If it is determined at the test step 1004 that the inactive chunk iscomplete, then control transfers from the step 1004 to the step 1008where the remote storage device waits for intervention by the host. Ifan inactive chunk, one of the hosts 702, 982, 984, as appropriate, needsto examine the state of all of the remote storage devices in themulti-box group to determine how to perform the recovery. This isdiscussed in more detail below.

Following step 1008 is a test step 1012 where it is determined if thehost has provided a command to all storage device to discard theinactive chunk. If so, then control transfers from the step 1012 to thestep 1006 to discard the inactive chunk. Following the step 1006,processing is complete.

If it is determined at the test step 1002 that the host has provided acommand to restore the complete inactive chunk, then control transfersfrom the step 1012 to a step 1014 where the inactive chunk is restoredto the remote storage device. Restoring the inactive chunk in the remotestorage device involves making the inactive chunk an active chunk andthen writing the active chunk to the disk as described elsewhere herein.Following the step 1014, processing is complete.

Referring to FIG. 24, a flow chart 1030 illustrates steps performed inconnection with one of the hosts 702, 982, 984 determining whether todiscard or restore each of the inactive chunks of each of the remotestorage devices. The one of the hosts 702, 982, 984 that is performingthe restoration communicates with the remote storage devices 706-708 toprovide commands thereto and to receive information therefrom using thetags that are assigned by the host as discussed elsewhere herein.

Processing begins at a first step 1032 where it is determined if any ofthe remote storage devices have a complete inactive chunk. If not, thenthere is no further processing to be performed and, as discussed above,the remote storage devices will discard the incomplete chunks on theirown without host intervention. Otherwise, control transfers from thetest step 1032 to a test step 1034 where the host determines if all ofthe remote storage devices have complete inactive chunks. If so, thencontrol transfers from the test step 1034 to a test step 1036 where itis determined if all of the complete inactive chunks of all of theremote storage devices have the same tag number. As discussed elsewhereherein, tags are assigned by the host and used by the system to identifydata in a manner similar to the sequence number except that tags arecontrolled by the host to have the same value for the same cycle.

If it is determined at the test step 1036 that all of the remote storagedevices have the same tag for the inactive chunks, then controltransfers from the step 1036 to a step 1038 where all of the inactivechunks are restored. Performing the step 1038 ensures that all of theremote storage devices have data from the same cycle. Following the step1038, processing is complete.

If it is determined at the test step 1034 that all of the inactivechunks are not complete, or if it is determined that at the step 1036that all of the complete inactive chunks do not have the same tag, thencontrol transfers to a step 1042 where the host provides a command tothe remote storage devices to restore the complete inactive chunkshaving the lower tag number. For purposes of explanation, it is assumedthat the tag numbers are incremented so that a lower tag numberrepresents older data. By way of example, if a first remote storagedevice had a complete inactive chunk with a tag value of three and asecond remote storage device had a complete inactive chunk with a tagvalue of four, the step 1042 would cause the first remote storage device(but not the second) to restore its inactive chunk. Following the step1042 is a step 1044 where the host provides commands to the remotestorage devices to discard the complete inactive buffers having a highertag number (e.g., the second remote storage device in the previousexample). Following step 1044, processing is complete.

Following execution of the step 1044, each of the remote storage devicescontains data associated with the same tag value as data for the otherones of the remote storage devices. Accordingly, the recovered data onthe remote storage devices 706-708 should be consistent.

While the invention has been disclosed in connection with variousembodiments, modifications thereon will be readily apparent to thoseskilled in the art. Accordingly, the spirit and scope of the inventionis set forth in the following claims.

What is claimed is:
 1. A computer-implemented method of ordering datawrites, comprising: a plurality of local storage devices receiving afirst plurality of data writes; an entity other than the plurality oflocal storage devices causing a coordinated and synchronized cycleswitch for the plurality of local storage devices wherein the firstplurality of data writes are associated with a particular cycle on eachlocal storage device in the plurality of local storage devices andwherein causing a cycle switch sending a first command to each of theplurality of the local storage devices to cause a coordinated andsynchronized cycle switch only after determining that all of theplurality of local storage devices are ready to switch; at least some ofthe plurality of local storage devices receiving a second plurality ofwrites after initiating the cycle switch wherein all of the secondplurality of writes are associated with a cycle different from theparticular cycle on each of the plurality of local storage devices; andafter completion of the cycle switch, each of the plurality of localstorage devices initiating transfer of the first plurality of writes toa corresponding remote storage device.
 2. A computer-implemented method,according to claim 1, wherein writes to the plurality of local storagedevices begun after initiating the cycle switch do not complete untilafter the cycle switch has completed.
 3. A computer-implemented method,according to claim 1, further comprising: following each of theplurality of local storage devices completing transfer of the firstplurality of writes to a corresponding remote storage device, each ofthe plurality of local storage devices sending a message to thecorresponding remote storage device.
 4. A computer-implemented method,according to claim 1, further comprising: providing the first pluralityof data writes to cache slots of the plurality of local storage devices.5. A computer-implemented method, according to claim 1, whereinreceiving a first plurality of data writes includes receiving aplurality of data writes from a host.
 6. A computer-implemented method,according to claim 1, wherein a host initiates the cycle switch.
 7. Acomputer-implemented method, according to claim 1, wherein initiatingthe cycle switch includes: waiting a predetermined amount of time.
 8. Acomputer-implemented method, according to claim 7, wherein sending acommand to initiate a cycle switch also causes writes begun after thefirst command to not complete until a second command is received.
 9. Acomputer-implemented method, according to claim 8, further comprising:after sending the first command to all of the local storage devices ofthe group, sending the second command to all of the plurality of localstorage devices to allow writes to complete.
 10. Computer software, in anon-transitory computer-readable medium, that orders data writes to aplurality of local storage devices, the software comprising: executablecode, provided in an entity other than the plurality of local storagedevices, that causes a coordinated and synchronized cycle switch for theplurality of local storage devices by sending a first command to each ofthe plurality of the local storage devices only after determining thatall of the plurality of local storage devices are ready to switch,wherein the first plurality of data writes are associated with aparticular cycle on each of the plurality of local storage devices;executable code that, for a second plurality of writes provided afterinitiating the cycle switch, associates all of the second plurality ofwrites with a cycle different from the particular cycle on each of theplurality of local storage devices; and executable code that causes eachof the plurality of local storage devices to initiate transfer of thefirst plurality of writes to a corresponding remote storage device aftercompletion of the cycle switch.
 11. Computer software, in acomputer-readable medium, according to claim 10, wherein writes to theplurality of local storage devices begun after initiating the cycleswitch do not complete until after the cycle switch has completed. 12.Computer software, in a computer-readable medium, according to claim 10,further comprising: executable code that causes each of the plurality oflocal storage devices to send a message to the corresponding remotestorage device following each of the plurality of local storage devicescompleting transfer of the first plurality of writes to a correspondingremote storage device.
 13. Computer software, in a computer-readablemedium, according to claim 10, further comprising: executable code thatprovides the first plurality of data writes to cache slots of theplurality of local storage devices.
 14. Computer software, in acomputer-readable medium, according to claim 10, wherein the firstplurality of data writes are from a host.
 15. Computer software, in acomputer-readable medium, according to claim 10, wherein a host runsexecutable code that initiates the cycle switch.
 16. Computer software,in a computer-readable medium, according to claim 10, wherein executablecode that initiates the cycle switch waits a predetermined amount oftime.
 17. Computer software, in a computer-readable medium, according toclaim 16, wherein executable code that sends a command to initiate acycle switch also causes writes begun after the first command to notcomplete until a second command is received.
 18. Computer software, in acomputer-readable medium, according to claim 17, further comprising:executable code that sends the second command to all of the plurality oflocal storage devices to allow writes to complete after sending thefirst command to all of the plurality of local storage devices.